package com.woniuxy.woniubookmanager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.woniubookmanager.entity.Book;
import com.woniuxy.woniubookmanager.mapper.BookMapper;
import com.woniuxy.woniubookmanager.service.BookService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.woniubookmanager.vo.BookVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wugd
 * @since 2022-11-29 04:03:13
 */
@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService {
    @Autowired
    BookMapper  bookMapper ;

    @Override
    public Page<BookVo> getBookByPage(Integer now, Integer size, String bname) {
        Page<BookVo> page = new Page<>(now,size);
        /*QueryWrapper<BookVo> queryWrapper = new QueryWrapper<>();
        if(bname != null && !"".equals(bname.trim())){
            queryWrapper.like("name",bname.trim());
        }*/
        Page<BookVo> p = bookMapper.selectBookByPage(page,bname);
        return p;
    }
}
